home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / General / GCC 1.37.1r15 / Documents / Using GCC < prev   
Text File  |  1993-01-14  |  5KB  |  97 lines

  1. This GCC port has been designed to fit as smoothly as possible into the MPW
  2. environment.  Once GCC has been installed, you need only change the name of
  3. the C compiler from "C" to "gC".  All of the usual MPW include files and libraries
  4. should work exactly the same as with MPW C; please let me know when they don't!
  5.  
  6. There are some known differences between GCC and MPW C:
  7.  
  8. * Some MPW C options are not implemented by GCC.  See GCC.Help for the exact list
  9. of what is available.
  10.  
  11. * The dump and load pragmas are not supported.  Their presence will
  12. not cause an error however.
  13.  
  14. * The preprocessor symbol __DUMP__ is always undefined.
  15.  
  16. * The preprocessor symbol __SEG__ cannot be used to set the segment.
  17.  
  18. * The preprocessor symbol "mpwgcc" is defined.
  19.  
  20. * The "comp" type is recognized and has code generated for it, but the
  21. library routines are presently undefined.
  22.  
  23. * -sym options are just passed on to the MPW assembler, so SADE won't be that
  24. useful with your C source code.
  25.  
  26. * Since GCC produces code that is processed by the MPW Assembler, any C symbols
  27. that are the same as the names of 68xxx registers (d0, sp, caar, etc) must be
  28. changed to something else.  GCC will postpend a _ and issue a warning that this
  29. is being done.  If all of your program is being compiled by GCC, there shouldn't
  30. be any problems, but if you mix MPW C and GCC code, then you will get linker
  31. errors, and must modify your source code to use different symbols.
  32.  
  33. * A number of MPW bugs and sloppinesses are missing from GCC.  Although this is
  34. generally good, you may find that GCC complains about a number of situations that
  35. MPW accepts silently (and sometimes incorrectly!).
  36.  
  37. * A common instance of this is when GCC complains about
  38.   void foo(short); ... void foo(x) short x; { ... }
  39. This really is incorrect code, but MPW won't complain.  GCC has been changed to
  40. only issue a warning rather than an error in these cases, but you can expect to
  41. see a lot of these.
  42.  
  43. ADDITIONAL FEATURES OF GCC
  44.  
  45. There are dozens of additional options and features in GCC, which I will only
  46. summarize here.  See the GCC.Help file and the GCC manual for full descriptions.
  47. Also, the Commando interface is a convenient tour of all the command options.
  48.  
  49. Additional language constructs include statements and declarations inside of
  50. expressions, named expression type, typeof, alignof, generalized lvalues, arrays of
  51. variable length, nonconstant initializers, constructor expressions, function
  52. inlining, and inline assembly code.  Note that these nice new constructs are
  53. not in MPW C, which will usually fail on them; the gC option -pedantic will
  54. issue warnings when any of these appear in your code.
  55.  
  56. Additional GCC options include the ability to generate assembly language output,
  57. optional optimization, a number of controls over warning messages, and a number of
  58. controls over compilation technique.
  59.  
  60. Optimization in GCC is extremely good.  On the 680x0, GCC will do excellent
  61. register allocation, in addition to maximally exploiting addressing modes.
  62. (A dramatic example is the inner loop of Mandelbrot calculation - GCC will use
  63. all eight FPx registers for temporaries.)  It does tend to favor code speed
  64. over size.  Some parts of the Mac interface are done awkwardly and/or slowly
  65. (such as non-68881 SANE calls and pascal returns).
  66.  
  67. USING C++
  68.  
  69. The script gCPlus is an approximate implementation of MPW C++.  It works by
  70. running CFront with options set to produce text output, then invoking gC on
  71. the result.  MPW C++ and C++ in general are moving targets, so you're more likely
  72. to run into incompatibilities and other problems (static constructors and
  73. destructors are sometimes a hassle, for instance).
  74.  
  75. FURTHER READING
  76.  
  77. Both the compiler and preprocessor have their own manuals, which are in TeX
  78. format.  The installation document describes ways to get them into printed form.
  79.  
  80. The most useful parts are those describing the extra command options in detail
  81. (since the manual was written for Unix GCC, many of the option names are different,
  82. so watch out), and the sections describing GCC's extensions to C.
  83.  
  84. IF gC CRASHES
  85.  
  86. When the compiler runs into trouble, it will generally calls fancy_abort, which goes
  87. into Macsbug.  "g" usually gets you back to MPW safely.  This should never occur for
  88. the distributed compiler; please report any occurrences, ideally including the source
  89. file and command options responsible.  GCC may occasionally produce code that the
  90. MPW Assembler will choke on; again, this shouldn't happen and should be reported
  91. when it does.  As a convenience when this happens, gC will leave the asm file
  92. around rather than deleting it.
  93.  
  94. Known problems with GCC are listed in the file "BUGS".  Fixes and/or suggestions
  95. to solve any of these problems will be gratefully accepted and incorporated into
  96. future releases of MPW GCC.
  97.